//
//  XMMyOrderCell.m
//  XMJJ_zml
//
//  Created by 丁浩 on 2025/5/26.
//

#import "XMMyOrderCell.h"

@interface XMMyOrderCell ()

@property (nonatomic, strong) UILabel *dateLabel;
@property (nonatomic, strong) UILabel *stateLabel;
@property (nonatomic, strong) UIImageView *avatarImgView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *priceLabel;
@property (nonatomic, strong) UILabel *timeLabel;
@property (nonatomic, strong) UILabel *addressLabel;
@property (nonatomic, strong) UILabel *totalPriceLabel;

@property (nonatomic, strong) UIButton *posiOneBtn;
@property (nonatomic, strong) UIButton *posiTwoBtn;
@property (nonatomic, strong) UIButton *posiThreeTypeOneBtn;
@property (nonatomic, strong) UIButton *posiThreeTypeTwoBtn;

@property (nonatomic, strong) UIImageView *resellInfoImgView; //转送
@property (nonatomic, strong) UILabel *resellLabel;  //转送信息


//@property (nonatomic, strong) UIButton *refundBtn;  //退款
//@property (nonatomic, strong) UIButton *givenBtn;  //赠送
//@property (nonatomic, strong) UIButton *resellBtn;  //转卖
//@property (nonatomic, strong) UIButton *cancelOrderBtn;  //取消订单
//@property (nonatomic, strong) UIButton *paymentBtn;  //立即付款
//@property (nonatomic, strong) UIButton *deleteBtn;  //删除订单
//@property (nonatomic, strong) UIButton *refundDetailBtn;  //退款详情
//@property (nonatomic, strong) UIButton *confirmEndBtn;  //确认结束
//@property (nonatomic, strong) UIButton *evaluateBtn;  //评价

@property (nonatomic, strong) XMMyOrderModel *orderModel;

@end

@implementation XMMyOrderCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatUI];
    }
    return self;
}

- (void)creatUI {
    [self addSubview:self.dateLabel];
    [self addSubview:self.stateLabel];
    [self addSubview:self.avatarImgView];
    [self addSubview:self.titleLabel];
    [self addSubview:self.priceLabel];
    [self addSubview:self.timeLabel];
    [self addSubview:self.addressLabel];
    [self addSubview:self.totalPriceLabel];
    
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, _avatarImgView.maxY + KScaleWidth(9.0), kScreenWidth, 1)];
    lineView.backgroundColor = kColorHEX(0xF1F1F1);
    [self addSubview:lineView];
    
    UIView *lineView2 = [[UIView alloc] initWithFrame:CGRectMake(0, lineView.maxY + KScaleWidth(58.0), kScreenWidth, 1)];
    lineView2.backgroundColor = kColorHEX(0xF1F1F1);
    [self addSubview:lineView2];
    
    UIImageView *timeIcon = [[UIImageView alloc] initWithFrame:CGRectMake(KScaleWidth(16.0), _timeLabel.y, KScaleWidth(12.0), _timeLabel.height)];
    timeIcon.contentMode = UIViewContentModeScaleAspectFit;
    timeIcon.image = ImageNamed(@"mine_time_icon");
    [self addSubview:timeIcon];
    
    UIImageView *addressIcon = [[UIImageView alloc] initWithFrame:CGRectMake(KScaleWidth(16.0), _addressLabel.y, KScaleWidth(12.0), _addressLabel.height)];
    addressIcon.contentMode = UIViewContentModeScaleAspectFit;
    addressIcon.image = ImageNamed(@"mine_address_icon");
    [self addSubview:addressIcon];
    
    [self.contentView addSubview:self.posiOneBtn];
    [self.contentView addSubview:self.posiTwoBtn];
    [self.contentView addSubview:self.posiThreeTypeOneBtn];
    [self.contentView addSubview:self.posiThreeTypeTwoBtn];
    [self addSubview:self.resellInfoImgView];
    [_resellInfoImgView addSubview:self.resellLabel];
    _resellInfoImgView.hidden = YES;
}

//状态 0全部，10等付款，20待见面，30见面中，40待评价，50退款售后 状态10等付数，20待见面，30见面中，40见面结束，11提出退款，12退款成功，13超时己关闭，14取消己关闭，15转卖,16赠送，17退款中，18退款审核通过，19退款成功，21拒绝退款
- (void)setContentWithOrderModel:(XMMyOrderModel *)orderModel
                       buyOrShow:(nonnull NSString *)buyOrShow {
    _orderModel = orderModel;
    if ([buyOrShow isEqualToString:@"1"]) {
        switch ([orderModel.status intValue]) {
            case 10: {
                _stateLabel.text = @"待付款";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = YES;
                _posiThreeTypeTwoBtn.hidden = NO;
                [_posiTwoBtn setTitle:@"取消订单" forState:UIControlStateNormal];
                [_posiThreeTypeTwoBtn setTitle:@"立即付款" forState:UIControlStateNormal];
            }
                break;
            case 11: {
                _stateLabel.text = @"退款中";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiThreeTypeOneBtn setTitle:@"退款详情" forState:UIControlStateNormal];
            }
                break;
            case 12: {
                _stateLabel.text = @"退款成功，订单关闭";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiTwoBtn setTitle:@"删除订单" forState:UIControlStateNormal];
                [_posiThreeTypeOneBtn setTitle:@"退款详情" forState:UIControlStateNormal];
            }
                break;
            case 13: {
                _stateLabel.text = @"超时未支付，订单关闭";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = YES;
                _posiThreeTypeTwoBtn.hidden = NO;
                [_posiTwoBtn setTitle:@"删除订单" forState:UIControlStateNormal];
                [_posiThreeTypeTwoBtn setTitle:@"重新下单" forState:UIControlStateNormal];
            }
                break;
            case 14: {
                _stateLabel.text = @"已主动取消，订单关闭";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = YES;
                _posiThreeTypeTwoBtn.hidden = NO;
                [_posiTwoBtn setTitle:@"删除订单" forState:UIControlStateNormal];
                [_posiThreeTypeTwoBtn setTitle:@"重新下单" forState:UIControlStateNormal];
            }
                break;
            case 15: {   //转卖 无按钮
                _stateLabel.text = @"已转卖";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = YES;
                _posiThreeTypeTwoBtn.hidden = YES;
                _resellInfoImgView.hidden = NO;
//            [_posiTwoBtn setTitle:@"取消订单" forState:UIControlStateNormal];
//            [_posiThreeTypeTwoBtn setTitle:@"立即付款" forState:UIControlStateNormal];
            }
                break;
            case 16: {   //已赠送。无按钮
                _stateLabel.text = @"已赠送";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = YES;
                _posiThreeTypeTwoBtn.hidden = YES;
                _resellInfoImgView.hidden = NO;
//            _resellLabel.text = [NSString stringWithFormat:@"见面包已赠送给%@", orderModel]
//            [_posiTwoBtn setTitle:@"取消订单" forState:UIControlStateNormal];
//            [_posiThreeTypeTwoBtn setTitle:@"立即付款" forState:UIControlStateNormal];
            }
                break;
            case 17: {
                _stateLabel.text = @"退款中";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiThreeTypeOneBtn setTitle:@"退款详情" forState:UIControlStateNormal];
            }
                break;
            case 18: {
                _stateLabel.text = @"退款成功，订单关闭";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiTwoBtn setTitle:@"删除订单" forState:UIControlStateNormal];
                [_posiThreeTypeOneBtn setTitle:@"退款详情" forState:UIControlStateNormal];
            }
                break;
            case 19: {
                _stateLabel.text = @"退款成功，订单关闭";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiTwoBtn setTitle:@"删除订单" forState:UIControlStateNormal];
                [_posiThreeTypeTwoBtn setTitle:@"退款详情" forState:UIControlStateNormal];
            }
                break;
            case 20: {
                _stateLabel.text = @"待见面";
                
                _posiOneBtn.hidden = NO;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = YES;
                _posiThreeTypeTwoBtn.hidden = NO;
                [_posiTwoBtn setTitle:@"赠送" forState:UIControlStateNormal];
                [_posiThreeTypeTwoBtn setTitle:@"申请退款" forState:UIControlStateNormal];
            }
                break;
            case 21: {
                _stateLabel.text = @"拒绝退款";
            }
                break;
            case 30: {
                _stateLabel.text = @"见面中";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = YES;
                _posiThreeTypeTwoBtn.hidden = NO;
                [_posiThreeTypeTwoBtn setTitle:@"确认结束" forState:UIControlStateNormal];
            }
                break;
            case 40: {
                _stateLabel.text = @"见面已结束";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiTwoBtn setTitle:@"删除订单" forState:UIControlStateNormal];
                [_posiThreeTypeOneBtn setTitle:@"去评价" forState:UIControlStateNormal];
            }
                break;
            case 50: {
                _stateLabel.text = @"等待对方处理";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiTwoBtn setTitle:@"退款详情" forState:UIControlStateNormal];
                [_posiThreeTypeOneBtn setTitle:@"取消退款" forState:UIControlStateNormal];
            }
                break;
                
            default:
                break;
        }
    }
    else {
        switch ([orderModel.status integerValue]) {
            case 10: {
                _stateLabel.text = @"待付款";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiThreeTypeOneBtn setTitle:@"取消订单" forState:UIControlStateNormal];
            }
                break;
            case 11: {  //提出退款
                _stateLabel.text = @"退款待审核";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = YES;
                _posiThreeTypeTwoBtn.hidden = NO;
                [_posiTwoBtn setTitle:@"拒绝退款" forState:UIControlStateNormal];
                [_posiThreeTypeTwoBtn setTitle:@"同意退款" forState:UIControlStateNormal];
            }
                break;
            case 12: {   //退款成功
                _stateLabel.text = @"已同意退款，订单关闭";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiTwoBtn setTitle:@"删除订单" forState:UIControlStateNormal];
                [_posiThreeTypeOneBtn setTitle:@"退款详情" forState:UIControlStateNormal];
            }
                break;
            case 13: {   //13超时己关闭，14取消己关闭，15转卖,16赠送，17退款中，18退款审核通过，19退款成功，21拒绝退款
                _stateLabel.text = @"对方超时未支付，订单关闭";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiThreeTypeOneBtn setTitle:@"删除订单" forState:UIControlStateNormal];
            }
                break;
            case 14: {
                _stateLabel.text = @"对方已主动取消，订单关闭";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiThreeTypeOneBtn setTitle:@"删除订单" forState:UIControlStateNormal];
            }
                break;
            case 15: {
                _stateLabel.text = @"对方已主动取消，订单关闭";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiThreeTypeOneBtn setTitle:@"删除订单" forState:UIControlStateNormal];
            }
                break;
            case 16: {
                _stateLabel.text = @"待见面";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = YES;
                _posiThreeTypeTwoBtn.hidden = NO;
                [_posiThreeTypeTwoBtn setTitle:@"扫码核验" forState:UIControlStateNormal];
            }
                break;
            case 17: {
                
            }
                break;
            case 18: {
                _stateLabel.text = @"已同意退款，订单关闭";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = NO;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiTwoBtn setTitle:@"删除订单" forState:UIControlStateNormal];
                [_posiThreeTypeOneBtn setTitle:@"退款详情" forState:UIControlStateNormal];
            }
                break;
            case 19: {
                
            }
                break;
            case 20: {
                _stateLabel.text = @"待见面";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = YES;
                _posiThreeTypeTwoBtn.hidden = NO;
                [_posiThreeTypeTwoBtn setTitle:@"扫码核验" forState:UIControlStateNormal];
            }
                break;
            case 21: {
                
            }
                break;
            case 30: {
                _stateLabel.text = @"见面中";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiThreeTypeOneBtn setTitle:@"联系对方" forState:UIControlStateNormal];
            }
                break;
            case 40: {
                _stateLabel.text = @"见面已结束";
                
                _posiOneBtn.hidden = YES;
                _posiTwoBtn.hidden = YES;
                _posiThreeTypeOneBtn.hidden = NO;
                _posiThreeTypeTwoBtn.hidden = YES;
                [_posiThreeTypeOneBtn setTitle:@"删除订单" forState:UIControlStateNormal];
            }
                break;
            case 50: {
                
            }
                break;
                
            default:
                break;
        }
    }
    NSString *dateStr = [[NSDate dateWithTimeIntervalSince1970:[orderModel.createTime integerValue]/1000] dateStringWithFormat:@"yyyy.MM.dd hh:mm:ss"];
    _dateLabel.text = dateStr;//@"2024.12.23 9:00:00";
//    _avatarImgView.image = [UIImage imageWithColor:kColorHEX(0x00ffff)];
    [_avatarImgView sd_setImageWithURL:[NSURL URLWithString:orderModel.coverImageUrl]];
    _titleLabel.text = orderModel.title;//@"简介简介简介简介简介简介简介简介 简介简";
    _priceLabel.text = [NSString stringWithFormat:@"¥%@", orderModel.price];//@"¥1300.00";
    NSString *serviceDateStr = [[NSDate dateWithTimeIntervalSince1970:[orderModel.serviceTime integerValue]/1000] dateStringWithFormat:@"yyyy.MM.dd hh:mm:ss"];
    _timeLabel.text = serviceDateStr;//@"2025.03.22 11:00:09";
    _addressLabel.text = orderModel.address;//@"安徽市宣化区乐凯大街12号";
    NSString *totalPriceStr = [NSString stringWithFormat:@"总金额 ¥%@", orderModel.price];
    NSMutableAttributedString *totalPriceAttr = [[NSMutableAttributedString alloc] initWithString:totalPriceStr attributes:@{NSFontAttributeName : KBoldFontSize(18.0), NSForegroundColorAttributeName : kColorHEX(0xDD4B39)}];
    [totalPriceAttr addAttributes:@{NSFontAttributeName : KFontSize(16.0), NSForegroundColorAttributeName : kColorHEX(0x333333)} range:NSMakeRange(0, 3)];
    [_totalPriceLabel setAttributedText:totalPriceAttr];
}

#pragma mark - BtnAction

- (void)posiOneBtnAction:(UIButton *)button {
    self.posiBtnActionBlock ? self.posiBtnActionBlock(1) : nil;
}

- (void)posiTwoBtnAction:(UIButton *)button {
    self.posiBtnActionBlock ? self.posiBtnActionBlock(2) : nil;
}

- (void)posiThreeTypeOneBtnAction:(UIButton *)button {
    self.posiBtnActionBlock ? self.posiBtnActionBlock(3) : nil;
}

- (void)posiThreeTypeTwoBtnAction:(UIButton *)button {
    self.posiBtnActionBlock ? self.posiBtnActionBlock(3) : nil;
}
////申请退款
//- (void)refundAction:(UIButton *)button {
//
//}
//
////赠送
//- (void)givenAction:(UIButton *)button {
//
//}
//
////转卖
//- (void)resellAction:(UIButton *)button {
//
//}
//
////取消订单
//- (void)cancelOrderAction:(UIButton *)button {
//
//}
//
////立即付款
//- (void)paymentAction:(UIButton *)button {
//
//}
//
////删除订单
//- (void)deleteAction:(UIButton *)button {
//
//}
//
////退款详情
//- (void)refunddetailAction:(UIButton *)button {
//
//}
//
////确认结束
//- (void)confirmEndAction:(UIButton *)button {
//
//}
//
////评价
//- (void)evaluateAction:(UIButton *)button {
//
//}

#pragma mark - Init
- (UILabel *)dateLabel {
    if (!_dateLabel) {
        _dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(KScaleWidth(16.0), KScaleWidth(12.0), kScreenWidth/2 - KScaleWidth(16.0), KScaleWidth(32.0)) font:KFontSize(16.0) textColor:kColorHEX(0x333333)];
    }
    return _dateLabel;
}

- (UILabel *)stateLabel {
    if (!_stateLabel) {
        _stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth/2, self.dateLabel.y, kScreenWidth/2 - KScaleWidth(16.0), _dateLabel.height) font:KFontSize(14.0) textColor:kColorHEX(0x368FD1) textAlignment:NSTextAlignmentRight];
    }
    return _stateLabel;
}

- (UIImageView *)avatarImgView {
    if (!_avatarImgView) {
        _avatarImgView = [[UIImageView alloc] initWithFrame:CGRectMake(KScaleWidth(16.0), KScaleWidth(47.0), KScaleWidth(80.0), KScaleWidth(80.0))];
//        _avatarImgView.contentMode = UIViewContentModeScaleAspectFit;
        [_avatarImgView setCornerRadius:KScaleWidth(8.0)];
    }
    return _avatarImgView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(KScaleWidth(103.0), KScaleWidth(46.0), kScreenWidth - KScaleWidth(103.0) - KScaleWidth(16.0), KScaleWidth(54.0)) font:KFontSize(16.0) textColor:kColorHEX(0x333333)];
    }
    return _titleLabel;
}

- (UILabel *)priceLabel {
    if (!_priceLabel) {
        _priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth/2, self.titleLabel.maxY, kScreenWidth/2 - KScaleWidth(16.0), KScaleWidth(27.0)) font:KBoldFontSize(18.0) textColor:kColorHEX(0x333333) textAlignment:NSTextAlignmentRight];
    }
    return _priceLabel;
}

- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(KScaleWidth(36.0), self.avatarImgView.maxY + KScaleWidth(15.0), kScreenWidth - KScaleWidth(36.0), KScaleWidth(24.0)) font:KFontSize(13.0) textColor:kColorHEX(0x666666)];
    }
    return _timeLabel;
}

- (UILabel *)addressLabel {
    if (!_addressLabel) {
        _addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.timeLabel.x, _timeLabel.maxY, _timeLabel.width, KScaleWidth(24.0)) font:KFontSize(13.0) textColor:kColorHEX(0x666666)];
    }
    return _addressLabel;
}

- (UILabel *)totalPriceLabel {
    if (!_totalPriceLabel) {
        _totalPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth/2, self.addressLabel.maxY + KScaleWidth(20.0), kScreenWidth/2 - KScaleWidth(16.0), KScaleWidth(28.0))];
        _totalPriceLabel.textAlignment = NSTextAlignmentRight;
    }
    return _totalPriceLabel;
}

- (UIButton *)posiOneBtn {
    if (!_posiOneBtn) {
        _posiOneBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(14.0) frame:CGRectMake(kScreenWidth - KScaleWidth(210.0) - KScaleWidth(90.0), KScaleWidth(310.0) - KScaleWidth(19.0) - KScaleWidth(38.0), KScaleWidth(90.0), KScaleWidth(38.0)) title:@"转卖" titleColor:kColorHEX(0x333333)];
        [_posiOneBtn setRadius:_posiOneBtn.height/2 borderColor:kColorHEX(0xCCCCCC) borderWidth:1];
        [_posiOneBtn addTarget:self action:@selector(posiOneBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _posiOneBtn;
}

- (UIButton *)posiTwoBtn {
    if (!_posiTwoBtn) {
        _posiTwoBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(14.0) frame:CGRectMake(self.posiOneBtn.maxX + KScaleWidth(8.0), _posiOneBtn.y, KScaleWidth(90.0), _posiOneBtn.height) title:@"赠送" titleColor:kColorHEX(0x333333)];
        [_posiTwoBtn setRadius:_posiTwoBtn.height/2 borderColor:kColorHEX(0xCCCCCC) borderWidth:1];
        [_posiTwoBtn addTarget:self action:@selector(posiTwoBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _posiTwoBtn;
}

- (UIButton *)posiThreeTypeOneBtn {
    if (!_posiThreeTypeOneBtn) {
        _posiThreeTypeOneBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(14.0) frame:CGRectMake(self.posiTwoBtn.maxX + KScaleWidth(8.0), _posiOneBtn.y, KScaleWidth(90.0), _posiOneBtn.height) title:@"赠送" titleColor:kColorHEX(0x333333)];
        [_posiThreeTypeOneBtn setRadius:_posiThreeTypeOneBtn.height/2 borderColor:kColorHEX(0xCCCCCC) borderWidth:1];
        [_posiThreeTypeOneBtn addTarget:self action:@selector(posiThreeTypeOneBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _posiThreeTypeOneBtn;
}

- (UIButton *)posiThreeTypeTwoBtn {
    if (!_posiThreeTypeTwoBtn) {
        _posiThreeTypeTwoBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KBoldFontSize(14.0) frame:self.posiThreeTypeOneBtn.frame title:@"申请退款" titleColor:kColorHEX(0x333333)];
        [_posiThreeTypeTwoBtn setGradientLayerWithLocations:@[@(0), @(1.0)] colors:@[(__bridge id)kColorHEX(0xFFD800).CGColor, (__bridge id)kColorHEX(0xFFE44E).CGColor] startPoint:CGPointMake(0.5, 0.37) endPoint:CGPointMake(0.03, 0.37)];
        [_posiThreeTypeTwoBtn setCornerRadius:_posiThreeTypeTwoBtn.height/2];
        [_posiThreeTypeTwoBtn addTarget:self action:@selector(posiThreeTypeTwoBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _posiThreeTypeTwoBtn;
}

- (UIImageView *)resellInfoImgView {
    if (!_resellInfoImgView) {
        _resellInfoImgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, KScaleWidth(244.0), kScreenWidth, KScaleWidth(65.0))];
    }
    return _resellInfoImgView;
}

//- (UIButton *)refundBtn {
//    if (!_refundBtn) {
//        _refundBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KBoldFontSize(14.0) frame:CGRectMake(kScreenWidth - KScaleWidth(16.0) - KScaleWidth(90.0), KScaleWidth(310.0) - KScaleWidth(19.0) - KScaleWidth(38.0), KScaleWidth(90.0), KScaleWidth(38.0)) title:@"申请退款" titleColor:kColorHEX(0x333333)];
//        [_refundBtn setGradientLayerWithLocations:@[@(0), @(1.0)] colors:@[(__bridge id)kColorHEX(0xFFD800).CGColor, (__bridge id)kColorHEX(0xFFE44E).CGColor] startPoint:CGPointMake(0.5, 0.37) endPoint:CGPointMake(0.03, 0.37)];
//        [_refundBtn setCornerRadius:_refundBtn.height/2];
//        [_refundBtn addTarget:self action:@selector(refundAction:) forControlEvents:UIControlEventTouchUpInside];
//    }
//    return _refundBtn;
//}
//
//- (UIButton *)givenBtn {
//    if (!_givenBtn) {
//        _givenBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(14.0) frame:CGRectMake(self.refundBtn.x - KScaleWidth(8.0) - KScaleWidth(90.0), _refundBtn.y, KScaleWidth(90.0), _refundBtn.height) title:@"赠送" titleColor:kColorHEX(0x333333)];
//        [_givenBtn setRadius:_givenBtn.height/2 borderColor:kColorHEX(0xCCCCCC) borderWidth:1];
//        [_givenBtn addTarget:self action:@selector(givenAction:) forControlEvents:UIControlEventTouchUpInside];
//    }
//    return _givenBtn;
//}
//
//- (UIButton *)resellBtn {
//    if (!_resellBtn) {
//        _resellBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(14.0) frame:CGRectMake(self.givenBtn.x - KScaleWidth(8.0) - KScaleWidth(90.0), _givenBtn.y, KScaleWidth(90.0), _givenBtn.height) title:@"转卖" titleColor:kColorHEX(0x333333)];
//        [_resellBtn setRadius:_resellBtn.height/2 borderColor:kColorHEX(0xCCCCCC) borderWidth:1];
//        [_resellBtn addTarget:self action:@selector(resellAction:) forControlEvents:UIControlEventTouchUpInside];
//    }
//    return _resellBtn;
//}
//
//- (UIButton *)cancelOrderBtn {
//    if (!_cancelOrderBtn) {
//        _cancelOrderBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(14.0) frame:self.givenBtn.frame title:@"取消订单" titleColor:kColorHEX(0x333333)];
//        [_cancelOrderBtn setRadius:_cancelOrderBtn.height/2 borderColor:kColorHEX(0xCCCCCC) borderWidth:1];
//        [_cancelOrderBtn addTarget:self action:@selector(cancelOrderAction:) forControlEvents:UIControlEventTouchUpInside];
//    }
//    return _cancelOrderBtn;
//}
//
////立即支付
//- (UIButton *)paymentBtn {
//    if (!_paymentBtn) {
//        _paymentBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KBoldFontSize(14.0) frame:self.refundBtn.frame title:@"立即付款" titleColor:kColorHEX(0x333333)];
//        [_paymentBtn setGradientLayerWithLocations:@[@(0), @(1.0)] colors:@[(__bridge id)kColorHEX(0xFFD800).CGColor, (__bridge id)kColorHEX(0xFFE44E).CGColor] startPoint:CGPointMake(0.5, 0.37) endPoint:CGPointMake(0.03, 0.37)];
//        [_paymentBtn setCornerRadius:_paymentBtn.height/2];
//        [_paymentBtn addTarget:self action:@selector(paymentAction:) forControlEvents:UIControlEventTouchUpInside];
//    }
//    return _paymentBtn;
//}
//
////删除订单
//- (UIButton *)deleteBtn {
//    if (!_deleteBtn) {
//        _deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(14.0) frame:self.cancelOrderBtn.frame title:@"删除订单" titleColor:kColorHEX(0x333333)];
//        [_deleteBtn setRadius:_deleteBtn.height/2 borderColor:kColorHEX(0xCCCCCC) borderWidth:1];
//        [_deleteBtn addTarget:self action:@selector(deleteAction:) forControlEvents:UIControlEventTouchUpInside];
//    }
//    return _deleteBtn;
//}
//
////退款详情
//- (UIButton *)refundDetailBtn {
//    if (!_refundDetailBtn) {
//        _refundDetailBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(14.0) frame:self.refundBtn.frame title:@"退款详情" titleColor:kColorHEX(0x333333)];
//        [_refundDetailBtn setRadius:_refundDetailBtn.height/2 borderColor:kColorHEX(0xCCCCCC) borderWidth:1];
//        [_refundDetailBtn addTarget:self action:@selector(refunddetailAction:) forControlEvents:UIControlEventTouchUpInside];
//    }
//    return _refundDetailBtn;
//}
//
////确认结束
//- (UIButton *)confirmEndBtn {
//    if (!_confirmEndBtn) {
//        _confirmEndBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KBoldFontSize(14.0) frame:self.refundDetailBtn.frame title:@"确认结束" titleColor:kColorHEX(0x333333)];
//        [_confirmEndBtn setGradientLayerWithLocations:@[@(0), @(1.0)] colors:@[(__bridge id)kColorHEX(0xFFD800).CGColor, (__bridge id)kColorHEX(0xFFE44E).CGColor] startPoint:CGPointMake(0.5, 0.37) endPoint:CGPointMake(0.03, 0.37)];
//        [_confirmEndBtn setCornerRadius:_confirmEndBtn.height/2];
//        [_confirmEndBtn addTarget:self action:@selector(confirmEndAction:) forControlEvents:UIControlEventTouchUpInside];
//    }
//    return _confirmEndBtn;
//}
//
////评价
//- (UIButton *)evaluateBtn {
//    if (!_evaluateBtn) {
//        _evaluateBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(14.0) frame:self.confirmEndBtn.frame title:@"去评价" titleColor:kColorHEX(0x333333)];
//        [_evaluateBtn setRadius:_evaluateBtn.height/2 borderColor:kColorHEX(0xCCCCCC) borderWidth:1];
//        [_evaluateBtn addTarget:self action:@selector(evaluateAction:) forControlEvents:UIControlEventTouchUpInside];
//    }
//    return _evaluateBtn;
//}

//@property (nonatomic, strong) UIButton *paymentBtn;  //立即付款
//@property (nonatomic, strong) UIButton *deleteBtn;  //删除订单
//@property (nonatomic, strong) UIButton *refundDetailBtn;  //退款详情
//@property (nonatomic, strong) UIButton *conformEndBtn;  //确认结束
//@property (nonatomic, strong) UIButton *evaluateBtn;  //评价

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
